package cn.yll.api.user.service;

import cn.yll.api.user.request.UserCashRequest;
import cn.yll.api.user.request.UserPwdLoginRequest;
import cn.yll.common.module.RestModel;
import cn.yll.api.user.request.UserRegisterRequest;
import cn.yll.api.user.response.UserBaseResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 用户相关接口
 * @author yangll
 */
@FeignClient(value = "shop-user", contextId = "userFeinService", path = "/user", fallbackFactory = RemoteUserFeignFallbackFactory.class)
public interface RemoteUserFeignService {

    /**
     * 用户注册接口
     */
    @PostMapping("/register")
    RestModel<UserBaseResponse> register(@RequestBody UserRegisterRequest user);

    /**
     * 校验用户密码接口
     */
    @PostMapping("validUserPwd")
    RestModel<UserBaseResponse> validUserPwd(@RequestBody UserPwdLoginRequest request);

    @PostMapping("cash")
    RestModel<Boolean> addCash(@RequestBody UserCashRequest request);

    /**
     * 根据用户ID查询扩展信息
     */
    @GetMapping("/getById/{id}")
    RestModel<UserBaseResponse> getUserById(@PathVariable("id") Long userId);

    /**
     * 根据用户名查询基本信息
     */
    @GetMapping("/getByUserName/{userName}")
    RestModel<UserBaseResponse> getByUserName(@PathVariable("userName") String userName);

    /**
     * 根据手机号查询用户信息
     */
    @GetMapping("/getByPhone/{phone}")
    RestModel<UserBaseResponse> getByPhone(@PathVariable("phone") String phone);
}
